00001
00002 #ifndef INCLUDED_LIB3DS_MESH_H
00003 #define INCLUDED_LIB3DS_MESH_H
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef INCLUDED_LIB3DS_TYPES_H
00027 #include <lib3ds/types.h>
00028 #endif
00029
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00034
00035
00036
00037
00038 typedef struct _Lib3dsPoint {
00039 Lib3dsVector pos;
00040 } Lib3dsPoint;
00041
00042
00043
00044
00045
00046 struct _Lib3dsFace {
00047 Lib3dsUserData user;
00048 char material[64];
00049 Lib3dsWord points[3];
00050 Lib3dsWord flags;
00051 Lib3dsDword smoothing;
00052 Lib3dsVector normal;
00053 };
00054
00055
00056
00057
00058
00059 struct _Lib3dsBoxMap {
00060 char front[64];
00061 char back[64];
00062 char left[64];
00063 char right[64];
00064 char top[64];
00065 char bottom[64];
00066 };
00067
00068
00069
00070
00071
00072 typedef enum {
00073 LIB3DS_MAP_NONE =0xFFFF,
00074 LIB3DS_MAP_PLANAR =0,
00075 LIB3DS_MAP_CYLINDRICAL =1,
00076 LIB3DS_MAP_SPHERICAL =2
00077 } Lib3dsMapType;
00078
00079
00080
00081
00082
00083 struct _Lib3dsMapData {
00084 Lib3dsWord maptype;
00085 Lib3dsVector pos;
00086 Lib3dsMatrix matrix;
00087 Lib3dsFloat scale;
00088 Lib3dsFloat tile[2];
00089 Lib3dsFloat planar_size[2];
00090 Lib3dsFloat cylinder_height;
00091 };
00092
00093
00094
00095
00096
00097 struct _Lib3dsMesh {
00098 Lib3dsUserData user;
00099 Lib3dsMesh *next;
00100 char name[64];
00101 Lib3dsByte color;
00102 Lib3dsMatrix matrix;
00103 Lib3dsDword points;
00104 Lib3dsPoint *pointL;
00105 Lib3dsDword flags;
00106 Lib3dsWord *flagL;
00107 Lib3dsDword texels;
00108 Lib3dsTexel *texelL;
00109 Lib3dsDword faces;
00110 Lib3dsFace *faceL;
00111 Lib3dsBoxMap box_map;
00112 Lib3dsMapData map_data;
00113 };
00114
00115 extern LIB3DSAPI Lib3dsMesh* lib3ds_mesh_new(const char *name);
00116 extern LIB3DSAPI void lib3ds_mesh_free(Lib3dsMesh *mesh);
00117 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_point_list(Lib3dsMesh *mesh, Lib3dsDword points);
00118 extern LIB3DSAPI void lib3ds_mesh_free_point_list(Lib3dsMesh *mesh);
00119 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_flag_list(Lib3dsMesh *mesh, Lib3dsDword flags);
00120 extern LIB3DSAPI void lib3ds_mesh_free_flag_list(Lib3dsMesh *mesh);
00121 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_texel_list(Lib3dsMesh *mesh, Lib3dsDword texels);
00122 extern LIB3DSAPI void lib3ds_mesh_free_texel_list(Lib3dsMesh *mesh);
00123 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_new_face_list(Lib3dsMesh *mesh, Lib3dsDword flags);
00124 extern LIB3DSAPI void lib3ds_mesh_free_face_list(Lib3dsMesh *mesh);
00125 extern LIB3DSAPI void lib3ds_mesh_bounding_box(Lib3dsMesh *mesh, Lib3dsVector min, Lib3dsVector max);
00126 extern LIB3DSAPI void lib3ds_mesh_calculate_normals(Lib3dsMesh *mesh, Lib3dsVector *normalL);
00127 extern LIB3DSAPI void lib3ds_mesh_dump(Lib3dsMesh *mesh);
00128 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_read(Lib3dsMesh *mesh, Lib3dsIo *io);
00129 extern LIB3DSAPI Lib3dsBool lib3ds_mesh_write(Lib3dsMesh *mesh, Lib3dsIo *io);
00130
00131 #ifdef __cplusplus
00132 };
00133 #endif
00134 #endif
00135